import random

def generate_test_case(length=None, min_val=-10**4, max_val=10**4):
    """生成测试用例数据"""
    if length is None:
        length = random.randint(1, 100)
    return [random.randint(min_val, max_val) for _ in range(length)]

def write_to_file(test_case, filename='input.txt'):
    """将测试用例写入文件"""
    with open(filename, 'w') as f:
        f.write(' '.join(map(str, test_case)))

if __name__ == "__main__":
    # 生成示例测试用例
    test_case = generate_test_case()
    write_to_file(test_case)
    print(f"已生成测试用例并写入 input.txt，长度: {len(test_case)}")    